import { Controller, Get, Res } from '@nestjs/common';
import { Response } from 'express';
import { SseService } from './sse.service';
import { JwtNoVerify } from '../../decorators';

@Controller('sse')
export class SseController {
  constructor(private readonly _sseService: SseService) {}

  @Get()
  @JwtNoVerify()
  async getEvents(@Res() res: Response) {
    return await this._sseService.addClient(res);
    // 保持响应开放
  }
}
